//917. 仅仅反转字母
//引入一个isalpha(是否字母)库函数，判断是否为字母的功能函数
#include <string.h>
#include <ctype.h>
void reverse(char* left, char* right)
{
    while (left < right)
    {   //考虑多种情况
        if (!isalpha(*left) && isalpha(*right))
            left++;
        else if (isalpha(*left) && !isalpha(*right))
            right--;
        else if (!isalpha(*left) && !isalpha(*right))
        {
            left++;
            right--;
        }
        else
        {
            char tmp = *left;
            *left = *right;
            *right = tmp;

            left++;
            right--;
        }
    }

}
char* reverseOnlyLetters(char* s) {
    int len = strlen(s);
    reverse(s, s + len - 1);

    return s;
}

